package com.shanzmoo.db.sys.entity.dto;

import com.alibaba.fastjson.JSON;
import com.shanzmoo.db.sys.entity.OutletInfoEntity;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import javax.validation.constraints.NotBlank;
import javax.validation.constraints.Size;
import java.io.Serializable;

/**
 * 门店信息保存对象
 * @author Gzhao
 * @date 2020/12/12
 */
@Data
@ApiModel("门店信息保存对象")
public class OutletInfoSaveDto implements Serializable {

    private static final long serialVersionUID = 1758L;

    @Size(max = 20, message = "门店名称太长")
    @NotBlank(message = "门店名称不允许为空")
    @ApiModelProperty("门店名称" )
    private String name;

    @Size(max = 100, message = "备注太长")
    @ApiModelProperty("备注" )
    private String remark;

    public OutletInfoEntity convert(Integer userId) {
        OutletInfoEntity outletInfoEntity = JSON.parseObject(JSON.toJSONString(this), OutletInfoEntity.class);
        outletInfoEntity.setCreateUser(userId);

        return outletInfoEntity;
    }
}
